﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TaoBaoServices;
using WangMiEntity;

namespace WangMiBusiness.CommonBusiness
{
    public class CommonBusinessHelper
    {
        /// <summary>
        /// 获取子帐号列表
        /// </summary>
        /// <param name="nick"></param>
        /// <param name="sessionKey"></param>
        /// <returns></returns>
        public static List<SubUsersEntity> GetSubUserList(string nick, string sessionKey)
        {
            List<SubUsersEntity> subUsersEntityList = new List<SubUsersEntity>();
            var userList = SubUserAPI.SellercenterSubusersGetResponse(nick, sessionKey);

            userList.Subusers.ForEach(item =>
            {
                SubUsersEntity subUsersEntity = new SubUsersEntity();
                subUsersEntity.IsOnline = item.IsOnline;
                subUsersEntity.SellerId = item.SellerId;
                subUsersEntity.SellerNick = item.SellerNick;
                subUsersEntity.Status = item.Status;
                subUsersEntity.SubUserFullName = item.FullName;
                subUsersEntity.SubUserId = item.SubId;
                subUsersEntity.SubUserNick = item.Nick;

                subUsersEntityList.Add(subUsersEntity);
            });

            return subUsersEntityList;
        }
    }
}
